Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script API: expand methods for displaying list of files and saves #2541

Merged

Conversation

ivan-mogilko
Copy link
Contributor

@ivan-mogilko ivan-mogilko commented Sep 29, 2024

Fix #816

This PR is a collection of additions, with the primary purpose to customize a list of saves that player may have in game, and remove existing historical limitation of 50 saves in list. It backports "range of slots" support in FilleSaveGameList (#2293) to 3.6.2, adds ability to retrieve file write times, and sort files in different order when using ListBox.FillDirList. The latter may be useful (besides other things) when making custom save lists.

Full list of additions.

  1. Backport of AGS 4: Script API: in FillSaveGameList() accept a range of slots #2293:
  • FillSaveGameList, RestoreGameDialog and SaveGameDialog support range of slots to display (1 - 50 by default, or in backwards mode)
  • Save slots no longer rearranged when calling DeleteSaveSlot (except when in backwards mode).
  • Added MoveSaveSlot() in case user wants to replicate this behavior (or for other uses).
  1. Added a config option "max_save" in "[override]" group that lets to manually set topmost save slot for standard save/restore dialogs. This is for MAXSAVEGAMES 50 #816, and primarily purposed for playing old games.
  2. New functions for getting file time:
  • static DateTime* File.GetFileTime(name)
  • static DateTime* Game.GetSaveSlotTime(saveSlot) - to accompany Game.GetSaveSlotDescription().
  1. ListBox.FillDirList() now supports sorting style and direction.
enum FileSortStyle
{
  eFileSort_None = 0,
  eFileSort_Name = 1,
  eFileSort_Time = 2
};

enum SortDirection
{
  eSortNoDirection = 0,
  eSortAscending   = 1,
  eSortDescending  = 2
};

void ListBox.FillDirList(const string fileMask,
                      FileSortStyle fileSortStyle = eFileSort_Name,
                      SortDirection sortDirection = eSortAscending);

@ivan-mogilko ivan-mogilko force-pushed the 362--expandsavefileapi branch 5 times, most recently from e08201a to 5ac3ec2 Compare October 4, 2024 14:49
@ivan-mogilko
Copy link
Contributor Author

Added a config option "max_save" in "[override]" group that lets to manually set topmost save slot for standard save/restore dialogs. This is for #816, and primarily purposed for playing old games.
It affects standard save/restore dialogs filled with list of saves. It won't (and technically cannot) affect any custom made save system.

@ivan-mogilko ivan-mogilko merged commit e5cbf18 into adventuregamestudio:master Oct 7, 2024
21 checks passed
@ivan-mogilko ivan-mogilko deleted the 362--expandsavefileapi branch October 7, 2024 16:44
@ivan-mogilko ivan-mogilko mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAXSAVEGAMES 50
1 participant